package com.zxkj.commonpatrol.adapt;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.DiffUtil;

import com.zxkj.commonpatrol.model.response.MediaInfoResponse;

import java.util.List;

public class MyDiffCallback  extends  DiffUtil.ItemCallback<MediaInfoResponse>{


    @Override
    public boolean areItemsTheSame(@NonNull MediaInfoResponse oldItem, @NonNull MediaInfoResponse newItem) {
        return oldItem.getId()==newItem.getId();
    }

    @Override
    public boolean areContentsTheSame(@NonNull MediaInfoResponse oldItem, @NonNull MediaInfoResponse newItem) {

        if (oldItem.getFristPath()==null){
            if (newItem.getFristPath()==null){
                return true;
            }else {
                return false;
            }
        }else{
            if (oldItem.getFristPath().equals(newItem.getFristPath())){
                  if (oldItem.getPhotoPtahs()!=null){
                       return true;
                  }else{
                      if (newItem.getPhotoPtahs()!=null){
                          return false;
                      }else{
                          return true;
                      }
                  }

            }else{
                return false;
            }
        }



    }

    @Nullable
    @Override
    public Object getChangePayload(@NonNull MediaInfoResponse oldItem, @NonNull MediaInfoResponse newItem) {
        return  null;
    }
}
